package 网络编程.综合练习.多发多收;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class 接收数据 {
    public static void main(String[] args) throws IOException {
        //1.创建服务器端
        ServerSocket ss=new ServerSocket(10086);

        //2.建立连接通道
        Socket socket = ss.accept();

        //3.从连接通道获取输出流
        BufferedReader bf = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        int b;
        System.out.print("对方发送的消息是：");
        while ((b=bf.read())!=-1){
            System.out.print((char) b);
        }
    }
}
